//
//  KaneNoteHeader.h
//  KaneNote
//
//  Created by HuanJing on 2017/7/11.
//  Copyright © 2017年 HuanJing. All rights reserved.
//

#ifndef KaneNoteHeader_h
#define KaneNoteHeader_h

#pragma mark- 屏幕相关
#define kSCREEN        [UIScreen mainScreen].bounds
#define kSCREEN_WIDTH  [UIScreen mainScreen].bounds.size.width
#define kSCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height

#define kNavBar_Height 64

#pragma mark- 颜色相关
#define kRGBColor(R,G,B)  [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:1.0];
#define kRGBAColor(r,g,b,a)  [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)];

#pragma mark- 设置NSLog
#ifdef DEBUG
    #define NSLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
    //定义打印当前方法的宏
    #define XXLogMethod() NSLog(@"%s", __func__)
#else
    #define NSLog(...)
    #define XXLogMethod()
#endif

#define HOST @"http://wiki.d.163.com/diablo"

//判断网络状态
#define CURRENT_NETWORK_STATUE [[RealReachability sharedInstance] currentReachabilityStatus]

#define HTML_ENCODING @"GB2312"

/**
 Synthsize a weak or strong reference.
 
 Example:
 @weakify(self)
 [self doSomething^{
 @strongify(self)
 if (!self) return;
 ...
 }];
 
 */
#ifndef weakify
    #if DEBUG
        #if __has_feature(objc_arc)
            #define weakify(object) autoreleasepool{} __weak __typeof__(object) weak##_##object = object;
        #else
            #define weakify(object) autoreleasepool{} __block __typeof__(object) block##_##object = object;
        #endif
    #else
        #if __has_feature(objc_arc)
            #define weakify(object) try{} @finally{} {} __weak __typeof__(object) weak##_##object = object;
        #else
            #define weakify(object) try{} @finally{} {} __block __typeof__(object) block##_##object = object;
        #endif
    #endif
#endif

#ifndef strongify
    #if DEBUG
        #if __has_feature(objc_arc)
            #define strongify(object) autoreleasepool{} __typeof__(object) object = weak##_##object;
        #else
            #define strongify(object) autoreleasepool{} __typeof__(object) object = block##_##object;
        #endif
    #else
        #if __has_feature(objc_arc)
            #define strongify(object) try{} @finally{} __typeof__(object) object = weak##_##object;
        #else
            #define strongify(object) try{} @finally{} __typeof__(object) object = block##_##object;
        #endif
    #endif
#endif

#endif /* KaneNoteHeader_h */
